<% if @tax_rate.errors.any? %>
  <div id="error_explanation">
    <h2><%= pluralize(@tax_rate.errors.count, "error") %> prohibited this tax_rate from being saved:</h2>

    <ul>
    <% @tax_rate.errors.full_messages.each do |msg| %>
      <li><%= msg %></li>
    <% end %>
    </ul>
  </div>
<% end %>

<fieldset>
  <label>Percentage</label>
  <%= f.text_field :percentage %>

  <label>Country</label>

  <% if Settings.tax_per_state_id %>
    <%= select_tag :select_country, options_from_collection_for_select(countries, "second", "first"), { include_blank: true } %>
    <label>State</label>
    <%= f.select :state_id, @states, { include_blank: true } %>
  <% else %>
    <label>Country</label>
    <%= f.select :country_id, countries, { include_blank: true } %>
  <% end %>

  <label>Start Date</label>
  <div class='date-select'>
    <%= f.date_select :start_date, { start_year: Time.zone.now.year, end_year: Time.zone.now.year + 12} %>
  </div>

  <label>End Date</label>
  <div class='date-select'>
    <%= f.date_select :end_date, { include_blank: true, start_year: Time.zone.now.year, end_year: Time.zone.now.year + 12} %>
  </div>

  <label>Active</label>
  <%= f.check_box :active %>
</fieldset>

<%= f.submit "Create", :class => "button" %>
